import request from "@/api/request";
import type { AxiosResponse } from "axios";

// get list
export type GetAdminUserParams = {
  page: number,
  page_size: number
}
export function getAdminUser(params: GetAdminUserParams): Promise<AxiosResponse> {
  return request('admin/admin_user_list', params, 'post')
}


// create
type CreateParams = {
  username: string,
  password: string,
  account_permission: number
}
export function create(params: CreateParams):Promise<AxiosResponse>{
  return request('admin/register_admin_user', params, 'post')
}

// update
type UpdateParams = {
  db_id: number,
  account_permission: number
}
export function update(params:UpdateParams):Promise<AxiosResponse>{
  return request('admin/update_admin_user', params, 'post')
}

// delete
type DeleteParams = {
  db_id: number
}
export function deleteApi(params: DeleteParams):Promise<AxiosResponse>{
  return request('admin/delete_admin_user', params, 'post')
}